﻿cmake_minimum_required (VERSION 3.1)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

set(AppName ExcelHeadTool)
project (${AppName})

function(assign_source_group)
    foreach(_source IN ITEMS ${ARGN})
        if (IS_ABSOLUTE "${_source}")
            file(RELATIVE_PATH _source_rel "${CMAKE_CURRENT_SOURCE_DIR}" "${_source}")
        else()
            set(_source_rel "${_source}")
        endif()
        get_filename_component(_source_path "${_source_rel}" PATH)
        string(REPLACE "/" "\\" _source_path_msvc "${_source_path}")
        source_group("${_source_path_msvc}" FILES "${_source}")
    endforeach()
endfunction(assign_source_group)

include_directories("${PROJECT_SOURCE_DIR}/External/glfw-3.3.2/include")
include_directories("${PROJECT_SOURCE_DIR}/External/imgui-1.85")
include_directories("${PROJECT_SOURCE_DIR}/External/ImGuiFileDialog")
include_directories("${PROJECT_SOURCE_DIR}/Framework")
include_directories("${PROJECT_SOURCE_DIR}/External/fmt/include")
include_directories("${PROJECT_SOURCE_DIR}/External/GL/include")
include_directories("${PROJECT_SOURCE_DIR}/External/glm-stable")

add_subdirectory(${PROJECT_SOURCE_DIR}/External/imgui-1.85)
add_subdirectory(${PROJECT_SOURCE_DIR}/External/ImGuiFileDialog)
add_subdirectory(${PROJECT_SOURCE_DIR}/External/OpenXLSX-0.3.2)
add_subdirectory(${PROJECT_SOURCE_DIR}/External/glfw-3.3.2)
add_subdirectory(${PROJECT_SOURCE_DIR}/Framework)
add_subdirectory(External/fmt)
add_subdirectory(External/GL)
add_subdirectory(External/glm-stable)

set_target_properties(ImGui
    PROPERTIES
    ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
    LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
    FOLDER "ThirdParty"
)

set_target_properties(glfw
    PROPERTIES
    ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
    LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
    FOLDER "ThirdParty"
)

set_target_properties(OpenXLSX
    PROPERTIES
    ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
    LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
    FOLDER "ThirdParty"
)

set_target_properties(ImGuiFileDialog
    PROPERTIES
    ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
    LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
    FOLDER "ThirdParty"
)

set_target_properties(fmt 
    PROPERTIES
    ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
    LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
    FOLDER "ThirdParty"
)

add_subdirectory(OpenglApp)




